<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
    <style type="text/css">
        body, html,#allmap {width: 100%;height: 100%;margin:0;font-family:"微软雅黑";}
        #l-map{height:500px;width:100%;}
    </style>
    <script type="text/javascript"
            src="http://api.map.baidu.com/api?v=2.0&ak=a2mxOoZ8cIHNQ5ZE4VlyCpN1nmIQSSF3"></script>
    <title>设置覆盖物的显示与隐藏</title>
</head>
<body>
<h3>Map Test</h3>
<div id="l-map"></div>
<div id="r-result">
    <input type="button" onclick="showOver()" value="显示" />
    <input type="button" onclick="hideOver()" value="隐藏" />
</div>
<script type="text/javascript">
    // 百度地图API功能
    var map = new BMap.Map("l-map");
    var point = new BMap.Point(116.404, 39.915);
    map.centerAndZoom(point, 15);

    var marker = new BMap.Marker(new BMap.Point(116.404, 39.915));  // 创建标注
    map.addOverlay(marker);              // 将标注添加到地图中

    var polyline = new BMap.Polyline([
        new BMap.Point(116.399, 39.910),
        new BMap.Point(116.405, 39.920),
        new BMap.Point(116.425, 39.900)
    ], {strokeColor:"blue", strokeWeight:6, strokeOpacity:0.5});
    map.addOverlay(polyline);          //增加折线

    var circle = new BMap.Circle(point,500);
    map.addOverlay(circle);            //增加圆
    hideOver();

    function showOver(){
        marker.show(); polyline.show(); circle.show();
    }
    function hideOver(){
        marker.hide(); polyline.hide(); circle.hide();
    }
</script>
</body>
</html>
